<template>
  <div style="margin: 10px 10px;">
    <div @click.stop="clickItem(item)" v-for="(item,index) in data" :key="index">{{item.name}}
    <TreeItem @on-click="clickItem" v-if="item?.children?.length"  :data="item.children" />    
    </div>
  </div>
</template>
<script setup lang='ts'>
import { TreeList } from '../../utils/js/type'

type Props = {

  data?: TreeList[]

}

const clickItem = (item: TreeList)=>{
  emit('on-click',item)
}


defineProps<Props>()

const emit = defineEmits(['on-click'])

</script>
<script lang="ts">
export default {
name:'TreeItem'
}
</script>
<style scoped lang='less'>





 
</style>